/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * CreateXMLWindow.java
 *
 * Created on Mar 25, 2011, 11:42:39 AM
 */
package org.dlsu.pdfgen.gui;

import java.awt.event.ActionEvent;
import java.text.ParseException;

import javax.swing.DefaultListModel;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;

import org.dlsu.pdfgen.io.JTextFieldFilter;

import java.io.*;
import java.text.NumberFormat;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.ListSelectionModel;
import javax.swing.text.MaskFormatter;

/**
 * 
 * @author Alvin
 */
public class CreateXMLWindow extends javax.swing.JFrame {

    /** Creates new form CreateXMLWindow */
    public CreateXMLWindow() {
        initComponents();
        System.out.println("GUI started.");
        setVisible(true);
        setLocationRelativeTo(null);

    }

    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        XMLTabbedPane = new javax.swing.JTabbedPane();
        jPanel1 = new javax.swing.JPanel();
        jLabel7 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel20 = new javax.swing.JLabel();
        MaskFormatter courseFormat = null;
        try {
            courseFormat = new MaskFormatter("*******");
            courseFormat.setValidCharacters("abcdefgihjklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-");
        } catch (ParseException ex) {
            Logger.getLogger(CreateXMLWindow.class.getName()).log(Level.SEVERE, null, ex);
        }
        courseCodeTxtField = new javax.swing.JFormattedTextField(courseFormat);
        courseTitleTxtField = new javax.swing.JTextField();
        coursePreRequisiteTxtField = new javax.swing.JTextField();
        courseTypeTxtField = new javax.swing.JTextField();
        facultyTxtField = new javax.swing.JTextField();
        termTxtField = new javax.swing.JTextField();
        timeTxtField = new javax.swing.JTextField();
        roomTxtField = new javax.swing.JTextField();
        jPanel2 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        descriptionTxtArea = new javax.swing.JTextArea();
        jPanel3 = new javax.swing.JPanel();
        jPanel9 = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        preambleTxtArea = new javax.swing.JTextArea();
        jPanel10 = new javax.swing.JPanel();
        jScrollPane3 = new javax.swing.JScrollPane();
        objectiveListModel = new DefaultListModel();
        objectivesList = new javax.swing.JList(objectiveListModel);
        objectiveRemoveButton = new javax.swing.JButton();
        objectiveAddButton = new javax.swing.JButton();
        objectiveTxtField = new javax.swing.JTextField();
        jPanel4 = new javax.swing.JPanel();
        jScrollPane4 = new javax.swing.JScrollPane();
        topicTableModel = new DefaultTableModel();
        topicsTable = new javax.swing.JTable();
        topicsTable.setModel(topicTableModel);

        topicsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        topicWeekTxtField = new javax.swing.JTextField();
        topicWeekTxtField.setDocument(new JTextFieldFilter(JTextFieldFilter.RANGED_NUMERIC));
        topicNameTxtField = new javax.swing.JTextField();
        topicHoursTxtField = new javax.swing.JTextField();
        topicHoursTxtField.setDocument(new JTextFieldFilter(JTextFieldFilter.FLOAT));
        topicAddButton = new javax.swing.JButton();
        topicRemoveButton = new javax.swing.JButton();
        jPanel5 = new javax.swing.JPanel();
        jScrollPane5 = new javax.swing.JScrollPane();
        requirementListModel = new DefaultListModel();
        requirementList = new javax.swing.JList(requirementListModel);
        requirementRemoveButton = new javax.swing.JButton();
        requirementAddButton = new javax.swing.JButton();
        requirementTxtField = new javax.swing.JTextField();
        jLabel15 = new javax.swing.JLabel();
        RequirmentListTypeComboBox = new javax.swing.JComboBox();
        jPanel6 = new javax.swing.JPanel();
        jScrollPane6 = new javax.swing.JScrollPane();
        assessmentTableModel = new DefaultTableModel();
        assessmentTable = new javax.swing.JTable(assessmentTableModel);
        jLabel13 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        assessmentItemTxtField = new javax.swing.JTextField();
        assessmentValueTxtField = new javax.swing.JTextField();
        assessmentValueTxtField.setDocument(new JTextFieldFilter(JTextFieldFilter.FLOAT));
        assessmentRemoveButton = new javax.swing.JButton();
        assessmentAddButton = new javax.swing.JButton();
        jPanel7 = new javax.swing.JPanel();
        textMaterialComboBox = new javax.swing.JComboBox();
        jLabel16 = new javax.swing.JLabel();
        textMaterialTxtField = new javax.swing.JTextField();
        jScrollPane7 = new javax.swing.JScrollPane();
        textMaterialListModel = new DefaultListModel();
        textMaterialList = new javax.swing.JList(textMaterialListModel);
        textMaterialRemoveButton = new javax.swing.JButton();
        textMaterialAddButton = new javax.swing.JButton();
        jPanel8 = new javax.swing.JPanel();
        referenceTxtField = new javax.swing.JTextField();
        referenceScrollPane = new javax.swing.JScrollPane();
        referenceListModel = new DefaultListModel();
        referenceList = new javax.swing.JList(referenceListModel);
        referenceRemoveButton = new javax.swing.JButton();
        referenceAddButton = new javax.swing.JButton();
        clearButton = new javax.swing.JButton();
        saveButton = new javax.swing.JButton();
        closeButton = new javax.swing.JButton();
        passingGradeTxtField = new javax.swing.JTextField();
        passingGradeTxtField.setDocument(new JTextFieldFilter(JTextFieldFilter.FLOAT));
        moveUp1 = new javax.swing.JButton("Move Up");
        moveDown1 = new javax.swing.JButton("Move Down");
        moveUp2 = new javax.swing.JButton("Move Up");
        moveDown2 = new javax.swing.JButton("Move Down");

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Create XML");
        setResizable(false);

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 14));
        jLabel1.setText("Create XML");

        jLabel7.setText("Term");

        jLabel5.setText("Course Type");

        jLabel6.setText("Faculty");

        jLabel4.setText("Course Pre-requisite");

        jLabel9.setText("Room");

        jLabel3.setText("Course Title");

        jLabel8.setText("Time");

        jLabel2.setText("Course Code");

        jLabel20.setText("Passing Grade");

        courseCodeTxtField.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {
                courseCodeTxtFieldActionPerformed(evt);
            }
        });

        courseTitleTxtField.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {
                courseTitleTxtFieldActionPerformed(evt);
            }
        });

        coursePreRequisiteTxtField.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {
                coursePreRequisiteTxtFieldActionPerformed(evt);
            }
        });

        courseTypeTxtField.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {
                courseTypeTxtFieldActionPerformed(evt);
            }
        });

        facultyTxtField.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {
                facultyTxtFieldActionPerformed(evt);
            }
        });

        termTxtField.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {
                termTxtFieldActionPerformed(evt);
            }
        });

        timeTxtField.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {
                timeTxtFieldActionPerformed(evt);
            }
        });

        roomTxtField.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {
                roomTxtFieldActionPerformed(evt);
            }
        });

        closeButton.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(ActionEvent e) {
                dispose();
            }
        });

        clearButton.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(ActionEvent arg0) {
                if (JOptionPane.showConfirmDialog(null,
                        "Data may be lost! Confirm?", "Clear",
                        JOptionPane.YES_NO_OPTION) == 0) {
                    dispose();
                    new CreateXMLWindow();
                }
            }
        });

        objectiveAddButton.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(ActionEvent arg0) {
                objectiveListModel.addElement(objectiveTxtField.getText());
                objectiveTxtField.setText("");
            }
        });

        objectiveRemoveButton.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(ActionEvent arg0) {

                for (int i = objectivesList.getModel().getSize() - 1; i >= 0; i--) {
                    if (objectivesList.isSelectedIndex(i)) {
                        objectiveListModel.remove(i);
                    }
                }
            }
        });

        requirementAddButton.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(ActionEvent e) {
                requirementListModel.addElement(requirementTxtField.getText());
                requirementTxtField.setText("");
            }
        });

        requirementRemoveButton.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(ActionEvent e) {
                for (int i = requirementList.getModel().getSize() - 1; i >= 0; i--) {
                    if (requirementList.isSelectedIndex(i)) {
                        requirementListModel.remove(i);
                    }
                }
            }
        });

        referenceAddButton.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(ActionEvent arg0) {
                referenceListModel.addElement(referenceTxtField.getText());
                referenceTxtField.setText("");
            }
        });

        referenceRemoveButton.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(ActionEvent arg0) {

                for (int i = referenceList.getModel().getSize() - 1; i >= 0; i--) {
                    if (referenceList.isSelectedIndex(i)) {
                        referenceListModel.remove(i);
                    }
                }
            }
        });

        textMaterialAddButton.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(ActionEvent arg0) {
                textMaterialListModel.addElement(textMaterialTxtField.getText());
                textMaterialTxtField.setText("");
            }
        });

        textMaterialRemoveButton.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(ActionEvent arg0) {

                for (int i = textMaterialList.getModel().getSize() - 1; i >= 0; i--) {
                    if (textMaterialList.isSelectedIndex(i)) {
                        textMaterialListModel.remove(i);
                    }
                }
            }
        });

        topicAddButton.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(ActionEvent arg0) {
                if (!topicWeekTxtField.getText().trim().equals("") && !topicNameTxtField.getText().trim().equals("") && !topicHoursTxtField.getText().trim().equals("")) {
                    ((DefaultTableModel) topicsTable.getModel()).addRow(new Object[]{topicWeekTxtField.getText(),
                                topicNameTxtField.getText(),
                                topicHoursTxtField.getText()});
                    topicWeekTxtField.setText("");
                    topicNameTxtField.setText("");
                    topicHoursTxtField.setText("");
                } else {
                    JOptionPane.showMessageDialog(null,
                            "Please fill up all forms.");
                }
            }
        });


        topicRemoveButton.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(ActionEvent arg0) {
                if (topicsTable.getSelectedRow() != -1) {
                    ((DefaultTableModel) topicsTable.getModel()).removeRow(topicsTable.getSelectedRow());
                }
            }
        });

        moveUp1.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(ActionEvent arg0) {
                if (topicsTable.getModel().getRowCount() > 0 && topicsTable.getSelectedRowCount() == 1 && topicsTable.getSelectedRow() > 0) {
                    int selection = topicsTable.getSelectedRow();
                    Object[] temp;
                    temp = new Object[]{topicsTable.getModel().getValueAt(topicsTable.getSelectedRow(), 0), topicsTable.getModel().getValueAt(topicsTable.getSelectedRow(), 1), topicsTable.getModel().getValueAt(topicsTable.getSelectedRow(), 2)};
                    topicsTable.getModel().setValueAt(topicsTable.getModel().getValueAt(topicsTable.getSelectedRow() - 1, 0), topicsTable.getSelectedRow(), 0);
                    topicsTable.getModel().setValueAt(topicsTable.getModel().getValueAt(topicsTable.getSelectedRow() - 1, 1), topicsTable.getSelectedRow(), 1);
                    topicsTable.getModel().setValueAt(topicsTable.getModel().getValueAt(topicsTable.getSelectedRow() - 1, 2), topicsTable.getSelectedRow(), 2);

                    topicsTable.getModel().setValueAt(temp[0], topicsTable.getSelectedRow() - 1, 0);
                    topicsTable.getModel().setValueAt(temp[1], topicsTable.getSelectedRow() - 1, 1);
                    topicsTable.getModel().setValueAt(temp[2], topicsTable.getSelectedRow() - 1, 2);

                    topicsTable.addRowSelectionInterval(selection - 1, selection - 1);
                }
            }
        });

        moveDown1.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(ActionEvent arg0) {
                if (topicsTable.getModel().getRowCount() > 0 && topicsTable.getSelectedRowCount() == 1 && topicsTable.getSelectedRow() < topicsTable.getRowCount() - 1) {
                    int selection = topicsTable.getSelectedRow();
                    Object[] temp;
                    temp = new Object[]{topicsTable.getModel().getValueAt(topicsTable.getSelectedRow(), 0), topicsTable.getModel().getValueAt(topicsTable.getSelectedRow(), 1), topicsTable.getModel().getValueAt(topicsTable.getSelectedRow(), 2)};
                    topicsTable.getModel().setValueAt(topicsTable.getModel().getValueAt(topicsTable.getSelectedRow() + 1, 0), topicsTable.getSelectedRow(), 0);
                    topicsTable.getModel().setValueAt(topicsTable.getModel().getValueAt(topicsTable.getSelectedRow() + 1, 1), topicsTable.getSelectedRow(), 1);
                    topicsTable.getModel().setValueAt(topicsTable.getModel().getValueAt(topicsTable.getSelectedRow() + 1, 2), topicsTable.getSelectedRow(), 2);

                    topicsTable.getModel().setValueAt(temp[0], topicsTable.getSelectedRow() + 1, 0);
                    topicsTable.getModel().setValueAt(temp[1], topicsTable.getSelectedRow() + 1, 1);
                    topicsTable.getModel().setValueAt(temp[2], topicsTable.getSelectedRow() + 1, 2);

                    topicsTable.addRowSelectionInterval(selection + 1, selection + 1);
                }
            }
        });

        assessmentAddButton.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(ActionEvent arg0) {
                ((DefaultTableModel) assessmentTable.getModel()).addRow(new Object[]{
                            assessmentItemTxtField.getText(),
                            assessmentValueTxtField.getText()});
                assessmentItemTxtField.setText("");
                assessmentValueTxtField.setText("");
            }
        });
        assessmentRemoveButton.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(ActionEvent arg0) {
                if (assessmentTable.getSelectedRow() != -1) {
                    ((DefaultTableModel) assessmentTable.getModel()).removeRow(assessmentTable.getSelectedRow());
                }
            }
        });

        moveUp2.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(ActionEvent arg0) {
                if (assessmentTable.getModel().getRowCount() > 0 && assessmentTable.getSelectedRowCount() == 1 && assessmentTable.getSelectedRow() > 0) {
                    int selection = assessmentTable.getSelectedRow();
                    Object[] temp;
                    temp = new Object[]{assessmentTable.getModel().getValueAt(assessmentTable.getSelectedRow(), 0), assessmentTable.getModel().getValueAt(assessmentTable.getSelectedRow(), 1), assessmentTable.getModel().getValueAt(assessmentTable.getSelectedRow(), 2)};
                    assessmentTable.getModel().setValueAt(assessmentTable.getModel().getValueAt(assessmentTable.getSelectedRow() - 1, 0), assessmentTable.getSelectedRow(), 0);
                    assessmentTable.getModel().setValueAt(assessmentTable.getModel().getValueAt(assessmentTable.getSelectedRow() - 1, 1), assessmentTable.getSelectedRow(), 1);
                    assessmentTable.getModel().setValueAt(assessmentTable.getModel().getValueAt(assessmentTable.getSelectedRow() - 1, 2), assessmentTable.getSelectedRow(), 2);

                    assessmentTable.getModel().setValueAt(temp[0], assessmentTable.getSelectedRow() - 1, 0);
                    assessmentTable.getModel().setValueAt(temp[1], assessmentTable.getSelectedRow() - 1, 1);
                    assessmentTable.getModel().setValueAt(temp[2], assessmentTable.getSelectedRow() - 1, 2);

                    assessmentTable.addRowSelectionInterval(selection - 1, selection - 1);
                }
            }
        });

        moveDown2.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(ActionEvent arg0) {
                if (assessmentTable.getModel().getRowCount() > 0 && assessmentTable.getSelectedRowCount() == 1 && assessmentTable.getSelectedRow() < assessmentTable.getRowCount() - 1) {
                    int selection = assessmentTable.getSelectedRow();
                    Object[] temp;
                    temp = new Object[]{assessmentTable.getModel().getValueAt(assessmentTable.getSelectedRow(), 0), assessmentTable.getModel().getValueAt(assessmentTable.getSelectedRow(), 1), assessmentTable.getModel().getValueAt(assessmentTable.getSelectedRow(), 2)};
                    assessmentTable.getModel().setValueAt(assessmentTable.getModel().getValueAt(assessmentTable.getSelectedRow() + 1, 0), assessmentTable.getSelectedRow(), 0);
                    assessmentTable.getModel().setValueAt(assessmentTable.getModel().getValueAt(assessmentTable.getSelectedRow() + 1, 1), assessmentTable.getSelectedRow(), 1);
                    assessmentTable.getModel().setValueAt(assessmentTable.getModel().getValueAt(assessmentTable.getSelectedRow() + 1, 2), assessmentTable.getSelectedRow(), 2);

                    assessmentTable.getModel().setValueAt(temp[0], assessmentTable.getSelectedRow() + 1, 0);
                    assessmentTable.getModel().setValueAt(temp[1], assessmentTable.getSelectedRow() + 1, 1);
                    assessmentTable.getModel().setValueAt(temp[2], assessmentTable.getSelectedRow() + 1, 2);

                    assessmentTable.addRowSelectionInterval(selection + 1, selection + 1);
                }
            }
        });

        saveButton.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(ActionEvent arg0) {
                String exportPath = new String();
                File f = new File("Untitled");
                final javax.swing.JFileChooser fc = new javax.swing.JFileChooser() {

                    public int showSaveDisplayQuestion(File file) {
                        String message = "File already exists! OK to overwrite?";
                        return JOptionPane.showOptionDialog(this, message, "Save Warning", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, null, null);
                    }

                    public void approveSelection() {
                        File file = getSelectedFile();
                        String x = file.getPath();
                        File temp = new File(x + ".xml");
                        System.out.println(temp.getPath());
                        if (getDialogType() == SAVE_DIALOG && file != null && (file.exists() || temp.exists())) {
                            int answer = showSaveDisplayQuestion(file);
                            if (answer == JOptionPane.NO_OPTION) {
                                // User doesn't want to overwrite the file
                                return;
                            } else {
                                super.approveSelection();
                            }
                        } else {
                            super.approveSelection();
                        }
                    }
                };

                fc.setSelectedFile(f);

                fc.setFileFilter(new javax.swing.filechooser.FileFilter() {

                    public boolean accept(File f) {
                        return f.getName().toLowerCase().endsWith(".xml")
                                || f.isDirectory();

                    }

                    public String getDescription() {
                        return "XML Generated Filet";
                    }
                });

                int returnVal = fc.showSaveDialog(null);
                if (returnVal == javax.swing.JFileChooser.APPROVE_OPTION) {
                        if (!fc.getSelectedFile().getPath().contains(".xml")) {
                            exportPath = fc.getSelectedFile().getPath() + ".xml";
                        } else {
                            exportPath = fc.getSelectedFile().getPath();
                        }
                        try {
                            OutputStream fout = new FileOutputStream(exportPath);
                            OutputStream bout = new BufferedOutputStream(fout);
                            OutputStreamWriter out = new OutputStreamWriter(bout);

                            out.write("<?xml version=\"1.0\"?>\n");
                            out.write("<syllabus>\n");
                            out.write("\t<code>" + courseCodeTxtField.getText()
                                    + "</code>\n");
                            out.write("\t<title>" + courseTitleTxtField.getText()
                                    + "</title>\n");
                            out.write("\t<prereqs>\n");
                            out.write("\t\t<pre>"
                                    + coursePreRequisiteTxtField.getText() + "</pre>\n");
                            out.write("\t</prereqs>\n");
                            out.write("\t<postreqs>\n");
                            out.write("\t\t<post></post>\n");
                            out.write("\t</postreqs>\n");
                            out.write("\t<type>" + courseTypeTxtField.getText()
                                    + "</type>\n");
                            out.write("\t<faculty>" + facultyTxtField.getText()
                                    + "</faculty>\n");
                            out.write("\t<passinggrade>" + passingGradeTxtField.getText() + "</passinggrade>\n");
                            out.write("\t<term>" + termTxtField.getText() + "</term>\n");
                            out.write("\t<time>" + timeTxtField.getText() + "</time>\n");
                            out.write("\t<room>" + roomTxtField.getText() + "</room>\n");

                            out.write("\t<description>" + descriptionTxtArea.getText()
                                    + "</description>\n");

                            out.write("\t<objectives>\n");
                            out.write("\t\t<preamble>" + preambleTxtArea.getText()
                                    + "</preamble>\n");
                            for (int i = 0; i < objectivesList.getModel().getSize(); i++) {
                                out.write("\t\t<objective>"
                                        + objectivesList.getModel().getElementAt(i)
                                        + "</objective>\n");
                            }
                            out.write("\t</objectives>\n");

                            out.write("\t<topics>\n");
                            for (int i = 0; i < topicsTable.getRowCount(); i++) {
                                out.write("\t\t<topic>\n");
                                out.write("\t\t\t\t<week>"
                                        + topicsTable.getModel().getValueAt(i, 0)
                                        + "</week>\n");
                                out.write("\t\t\t\t<name>"
                                        + topicsTable.getModel().getValueAt(i, 1)
                                        + "</name>\n");
                                out.write("\t\t\t\t<hour>"
                                        + topicsTable.getModel().getValueAt(i, 2)
                                        + "</hour>\n");
                                out.write("\t\t</topic>\n");
                            }
                            out.write("\t</topics>\n");

                            out.write("\t<requirements listType=\""
                                    + (String) RequirmentListTypeComboBox.getSelectedItem() + "\">\n");
                            for (int i = 0; i < requirementList.getModel().getSize(); i++) {
                                out.write("\t\t<req>"
                                        + requirementList.getModel().getElementAt(i)
                                        + "</req>\n");
                            }
                            out.write("\t</requirements>\n");

                            out.write("\t<assessments>\n");
                            for (int i = 0; i < assessmentTable.getRowCount(); i++) {
                                out.write("\t\t<assessment>\n");
                                out.write("\t\t\t\t<item>"
                                        + assessmentTable.getModel().getValueAt(i, 0)
                                        + "</item>\n");
                                out.write("\t\t\t\t<value>"
                                        + assessmentTable.getModel().getValueAt(i, 1)
                                        + "</value>\n");
                                out.write("\t\t</assessment>\n");
                            }
                            out.write("\t</assessments>\n");

                            out.write("\t<materials listType=\""
                                    + (String) textMaterialComboBox.getSelectedItem()
                                    + "\">\n");
                            for (int i = 0; i < textMaterialList.getModel().getSize(); i++) {
                                out.write("\t\t<material>"
                                        + textMaterialList.getModel().getElementAt(i)
                                        + "</material>\n");
                            }
                            out.write("\t</materials>\n");

                            out.write("\t<references>\n");
                            for (int i = 0; i < referenceList.getModel().getSize(); i++) {
                                out.write("\t\t<ref>"
                                        + referenceList.getModel().getElementAt(i)
                                        + "</ref>\n");
                            }
                            out.write("\t</references>\n");

                            out.write("</syllabus>");
                            out.flush();
                            out.close();
                            System.out.println("XML Generated");

                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                        JOptionPane.showMessageDialog(null, "XML file successfully generated!", "Success", JOptionPane.INFORMATION_MESSAGE);
                }

            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(
                jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(jPanel1Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.LEADING).addGroup(
                javax.swing.GroupLayout.Alignment.TRAILING,
                jPanel1Layout.createSequentialGroup().addContainerGap().addGroup(
                jPanel1Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.TRAILING).addComponent(jLabel5).addComponent(jLabel3).addComponent(jLabel2).addComponent(jLabel4).addComponent(jLabel6).addComponent(jLabel7).addComponent(jLabel8).addComponent(jLabel9).addComponent(jLabel20)).addPreferredGap(
                javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(
                jPanel1Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.LEADING).addComponent(
                courseCodeTxtField,
                javax.swing.GroupLayout.Alignment.TRAILING,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                317,
                Short.MAX_VALUE).addComponent(
                courseTitleTxtField,
                javax.swing.GroupLayout.Alignment.TRAILING,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                317,
                Short.MAX_VALUE).addComponent(
                coursePreRequisiteTxtField,
                javax.swing.GroupLayout.Alignment.TRAILING,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                317,
                Short.MAX_VALUE).addComponent(
                courseTypeTxtField,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                317,
                Short.MAX_VALUE).addComponent(
                facultyTxtField,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                317,
                Short.MAX_VALUE).addComponent(
                passingGradeTxtField,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                317,
                Short.MAX_VALUE).addGroup(
                jPanel1Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.TRAILING,
                false).addComponent(
                roomTxtField,
                javax.swing.GroupLayout.Alignment.LEADING).addComponent(
                timeTxtField,
                javax.swing.GroupLayout.Alignment.LEADING).addComponent(
                termTxtField,
                javax.swing.GroupLayout.Alignment.LEADING,
                javax.swing.GroupLayout.PREFERRED_SIZE,
                143,
                javax.swing.GroupLayout.PREFERRED_SIZE))).addContainerGap()));
        jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.LEADING).addGroup(
                jPanel1Layout.createSequentialGroup().addContainerGap().addGroup(
                jPanel1Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel2).addComponent(
                courseCodeTxtField,
                javax.swing.GroupLayout.PREFERRED_SIZE,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(
                javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(
                jPanel1Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel3).addComponent(
                courseTitleTxtField,
                javax.swing.GroupLayout.PREFERRED_SIZE,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(
                javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(
                jPanel1Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel4).addComponent(
                coursePreRequisiteTxtField,
                javax.swing.GroupLayout.PREFERRED_SIZE,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(
                javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(
                jPanel1Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel5).addComponent(
                courseTypeTxtField,
                javax.swing.GroupLayout.PREFERRED_SIZE,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(
                javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(
                jPanel1Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel6).addComponent(
                facultyTxtField,
                javax.swing.GroupLayout.PREFERRED_SIZE,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(
                javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(
                jPanel1Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel20).addComponent(
                passingGradeTxtField,
                javax.swing.GroupLayout.PREFERRED_SIZE,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(
                javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(
                jPanel1Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel7).addComponent(
                termTxtField,
                javax.swing.GroupLayout.PREFERRED_SIZE,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(
                javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(
                jPanel1Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel8).addComponent(
                timeTxtField,
                javax.swing.GroupLayout.PREFERRED_SIZE,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(
                javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(
                jPanel1Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel9).addComponent(
                roomTxtField,
                javax.swing.GroupLayout.PREFERRED_SIZE,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                javax.swing.GroupLayout.PREFERRED_SIZE)).addContainerGap(88, Short.MAX_VALUE)));

        XMLTabbedPane.addTab("Details", jPanel1);

        descriptionTxtArea.setColumns(20);
        descriptionTxtArea.setFont(new java.awt.Font("Tahoma", 0, 11));
        descriptionTxtArea.setRows(5);
        descriptionTxtArea.setCursor(new java.awt.Cursor(
                java.awt.Cursor.TEXT_CURSOR));
        jScrollPane1.setViewportView(descriptionTxtArea);

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(
                jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(jPanel2Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.LEADING).addGroup(
                jPanel2Layout.createSequentialGroup().addContainerGap().addComponent(jScrollPane1,
                javax.swing.GroupLayout.DEFAULT_SIZE, 419,
                Short.MAX_VALUE).addContainerGap()));
        jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.LEADING).addGroup(
                jPanel2Layout.createSequentialGroup().addContainerGap().addComponent(jScrollPane1,
                javax.swing.GroupLayout.DEFAULT_SIZE, 279,
                Short.MAX_VALUE).addContainerGap()));

        XMLTabbedPane.addTab("Description", jPanel2);

        jPanel9.setBorder(javax.swing.BorderFactory.createTitledBorder("Preamble"));

        preambleTxtArea.setColumns(20);
        preambleTxtArea.setFont(new java.awt.Font("Tahoma", 0, 11));
        preambleTxtArea.setRows(3);
        jScrollPane2.setViewportView(preambleTxtArea);

        javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(
                jPanel9);
        jPanel9.setLayout(jPanel9Layout);
        jPanel9Layout.setHorizontalGroup(jPanel9Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.LEADING).addGroup(
                jPanel9Layout.createSequentialGroup().addContainerGap().addComponent(jScrollPane2,
                javax.swing.GroupLayout.DEFAULT_SIZE, 387,
                Short.MAX_VALUE).addContainerGap()));
        jPanel9Layout.setVerticalGroup(jPanel9Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.LEADING).addGroup(
                jPanel9Layout.createSequentialGroup().addContainerGap().addComponent(jScrollPane2,
                javax.swing.GroupLayout.PREFERRED_SIZE, 69,
                javax.swing.GroupLayout.PREFERRED_SIZE).addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
                Short.MAX_VALUE)));

        jPanel10.setBorder(javax.swing.BorderFactory.createTitledBorder("Objectives"));

        jScrollPane3.setViewportView(objectivesList);

        objectiveRemoveButton.setText("Remove");

        objectiveAddButton.setText("Add");

        javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(
                jPanel10);
        jPanel10.setLayout(jPanel10Layout);
        jPanel10Layout.setHorizontalGroup(jPanel10Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.LEADING).addGroup(
                javax.swing.GroupLayout.Alignment.TRAILING,
                jPanel10Layout.createSequentialGroup().addContainerGap().addGroup(
                jPanel10Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.TRAILING).addComponent(
                jScrollPane3,
                javax.swing.GroupLayout.Alignment.LEADING,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                387,
                Short.MAX_VALUE).addGroup(
                jPanel10Layout.createSequentialGroup().addComponent(
                objectiveTxtField,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                253,
                Short.MAX_VALUE).addPreferredGap(
                javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(
                objectiveAddButton).addPreferredGap(
                javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(
                objectiveRemoveButton))).addContainerGap()));
        jPanel10Layout.setVerticalGroup(jPanel10Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.LEADING).addGroup(
                javax.swing.GroupLayout.Alignment.TRAILING,
                jPanel10Layout.createSequentialGroup().addContainerGap().addComponent(
                jScrollPane3,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                77, Short.MAX_VALUE).addPreferredGap(
                javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(
                jPanel10Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.BASELINE).addComponent(
                objectiveRemoveButton).addComponent(
                objectiveAddButton).addComponent(
                objectiveTxtField,
                javax.swing.GroupLayout.PREFERRED_SIZE,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                javax.swing.GroupLayout.PREFERRED_SIZE)).addContainerGap()));

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(
                jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(jPanel3Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.LEADING).addGroup(
                javax.swing.GroupLayout.Alignment.TRAILING,
                jPanel3Layout.createSequentialGroup().addContainerGap().addGroup(
                jPanel3Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.TRAILING).addComponent(
                jPanel10,
                javax.swing.GroupLayout.Alignment.LEADING,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                Short.MAX_VALUE).addComponent(
                jPanel9,
                javax.swing.GroupLayout.Alignment.LEADING,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                Short.MAX_VALUE)).addContainerGap()));
        jPanel3Layout.setVerticalGroup(jPanel3Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.LEADING).addGroup(
                jPanel3Layout.createSequentialGroup().addContainerGap().addComponent(
                jPanel9,
                javax.swing.GroupLayout.PREFERRED_SIZE,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(
                javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(
                jPanel10,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                Short.MAX_VALUE).addContainerGap()));

        XMLTabbedPane.addTab("Objectives", jPanel3);

        topicsTable.setModel(new javax.swing.table.DefaultTableModel(
                new Object[][]{}, new String[]{"Week", "Name", "Hours"}) {

            boolean[] canEdit = new boolean[]{false, false, false};

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit[columnIndex];
            }
        });
        jScrollPane4.setViewportView(topicsTable);

        jLabel10.setText("Week");

        jLabel11.setText("Name");

        jLabel12.setText("Hours");

        topicWeekTxtField.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {
                topicWeekTextFieldActionPerformed(evt);
            }
        });

        topicAddButton.setText("Add");
        topicAddButton.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {
                topicAddButtonActionPerformed(evt);
            }
        });

        topicRemoveButton.setText("Remove");
        topicRemoveButton.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {
                topicRemoveButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(
                jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(jPanel4Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.LEADING).addGroup(
                javax.swing.GroupLayout.Alignment.TRAILING,
                jPanel4Layout.createSequentialGroup().addContainerGap().addGroup(
                jPanel4Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.TRAILING).addComponent(
                jScrollPane4,
                javax.swing.GroupLayout.Alignment.LEADING,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                419,
                Short.MAX_VALUE).addGroup(
                javax.swing.GroupLayout.Alignment.LEADING,
                jPanel4Layout.createSequentialGroup().addGroup(
                jPanel4Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.TRAILING).addComponent(
                jLabel10).addComponent(
                jLabel11).addComponent(
                jLabel12)).addPreferredGap(
                javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).addGroup(
                jPanel4Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.LEADING).addComponent(
                topicHoursTxtField,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                381,
                Short.MAX_VALUE).addComponent(
                topicNameTxtField,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                381,
                Short.MAX_VALUE).addComponent(
                topicWeekTxtField,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                381,
                Short.MAX_VALUE))).addGroup(
                jPanel4Layout.createSequentialGroup().addComponent(
                topicAddButton).addPreferredGap(
                javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(
                topicRemoveButton))).addContainerGap()));
        jPanel4Layout.setVerticalGroup(jPanel4Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.LEADING).addGroup(
                javax.swing.GroupLayout.Alignment.TRAILING,
                jPanel4Layout.createSequentialGroup().addContainerGap().addComponent(
                jScrollPane4,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                172, Short.MAX_VALUE).addPreferredGap(
                javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(
                jPanel4Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel10).addComponent(
                topicWeekTxtField,
                javax.swing.GroupLayout.PREFERRED_SIZE,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(
                javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(
                jPanel4Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel11).addComponent(
                topicNameTxtField,
                javax.swing.GroupLayout.PREFERRED_SIZE,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(
                javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(
                jPanel4Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel12).addComponent(
                topicHoursTxtField,
                javax.swing.GroupLayout.PREFERRED_SIZE,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(
                javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(
                jPanel4Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.BASELINE).addComponent(
                topicRemoveButton).addComponent(
                topicAddButton)).addContainerGap()));

        jPanel4.add(moveUp1);
        jPanel4.add(moveDown1);
        moveUp1.setBounds(12, 260, 85, 25);
        moveDown1.setBounds(103, 260, 100, 25);

        XMLTabbedPane.addTab("Topics", jPanel4);

        jScrollPane5.setViewportView(requirementList);

        requirementRemoveButton.setText("Remove");
        requirementRemoveButton.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {
                requirementRemoveButtonActionPerformed(evt);
            }
        });

        requirementAddButton.setText("Add");

        jLabel15.setText("List Type");

        RequirmentListTypeComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[]{
                    "Numbered", "Bulleted"}));

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(
                jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(jPanel5Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.LEADING).addGroup(
                javax.swing.GroupLayout.Alignment.TRAILING,
                jPanel5Layout.createSequentialGroup().addContainerGap().addGroup(
                jPanel5Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.TRAILING).addComponent(
                jScrollPane5,
                javax.swing.GroupLayout.Alignment.LEADING,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                419,
                Short.MAX_VALUE).addGroup(
                jPanel5Layout.createSequentialGroup().addComponent(
                requirementTxtField,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                285,
                Short.MAX_VALUE).addPreferredGap(
                javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(
                requirementAddButton).addPreferredGap(
                javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(
                requirementRemoveButton)).addGroup(
                javax.swing.GroupLayout.Alignment.LEADING,
                jPanel5Layout.createSequentialGroup().addComponent(
                jLabel15).addPreferredGap(
                javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(
                RequirmentListTypeComboBox,
                javax.swing.GroupLayout.PREFERRED_SIZE,
                109,
                javax.swing.GroupLayout.PREFERRED_SIZE))).addContainerGap()));
        jPanel5Layout.setVerticalGroup(jPanel5Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.LEADING).addGroup(
                javax.swing.GroupLayout.Alignment.TRAILING,
                jPanel5Layout.createSequentialGroup().addContainerGap().addGroup(
                jPanel5Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel15).addComponent(
                RequirmentListTypeComboBox,
                javax.swing.GroupLayout.PREFERRED_SIZE,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(
                javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(
                jScrollPane5,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                224, Short.MAX_VALUE).addPreferredGap(
                javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(
                jPanel5Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.BASELINE).addComponent(
                requirementRemoveButton).addComponent(
                requirementAddButton).addComponent(
                requirementTxtField,
                javax.swing.GroupLayout.PREFERRED_SIZE,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                javax.swing.GroupLayout.PREFERRED_SIZE)).addContainerGap()));

        XMLTabbedPane.addTab("Requirements", jPanel5);

        assessmentTable.setModel(new javax.swing.table.DefaultTableModel(
                new Object[][]{}, new String[]{"Item", "Value"}) {

            boolean[] canEdit = new boolean[]{false, false};

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit[columnIndex];
            }
        });
        jScrollPane6.setViewportView(assessmentTable);

        jLabel13.setText("Item");

        jLabel14.setText("Value");

        assessmentItemTxtField.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {
                assessmentItemTxtFieldActionPerformed(evt);
            }
        });

        assessmentRemoveButton.setText("Remove");

        assessmentAddButton.setText("Add");

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(
                jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(jPanel6Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.LEADING).addGroup(
                javax.swing.GroupLayout.Alignment.TRAILING,
                jPanel6Layout.createSequentialGroup().addContainerGap().addGroup(
                jPanel6Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.TRAILING).addComponent(
                jScrollPane6,
                javax.swing.GroupLayout.Alignment.LEADING,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                419,
                Short.MAX_VALUE).addGroup(
                javax.swing.GroupLayout.Alignment.LEADING,
                jPanel6Layout.createSequentialGroup().addGroup(
                jPanel6Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.TRAILING).addComponent(
                jLabel13).addComponent(
                jLabel14)).addPreferredGap(
                javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).addGroup(
                jPanel6Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.LEADING).addComponent(
                assessmentValueTxtField,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                383,
                Short.MAX_VALUE).addComponent(
                assessmentItemTxtField,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                383,
                Short.MAX_VALUE))).addGroup(
                jPanel6Layout.createSequentialGroup().addComponent(
                assessmentAddButton).addPreferredGap(
                javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(
                assessmentRemoveButton))).addContainerGap()));
        jPanel6Layout.setVerticalGroup(jPanel6Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.LEADING).addGroup(
                javax.swing.GroupLayout.Alignment.TRAILING,
                jPanel6Layout.createSequentialGroup().addContainerGap().addComponent(
                jScrollPane6,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                198, Short.MAX_VALUE).addPreferredGap(
                javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(
                jPanel6Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel13).addComponent(
                assessmentItemTxtField,
                javax.swing.GroupLayout.PREFERRED_SIZE,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(
                javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(
                jPanel6Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.BASELINE).addComponent(
                assessmentValueTxtField,
                javax.swing.GroupLayout.PREFERRED_SIZE,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jLabel14)).addPreferredGap(
                javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(
                jPanel6Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.BASELINE).addComponent(
                assessmentRemoveButton).addComponent(
                assessmentAddButton)).addContainerGap()));

        jPanel6.add(moveUp2);
        jPanel6.add(moveDown2);
        moveUp2.setBounds(12, 260, 85, 25);
        moveDown2.setBounds(103, 260, 100, 25);

        XMLTabbedPane.addTab("Assessment", jPanel6);

        textMaterialComboBox.setModel(new javax.swing.DefaultComboBoxModel(
                new String[]{"Numbered", "Bulleted"}));

        jLabel16.setText("List Type");

        jScrollPane7.setViewportView(textMaterialList);

        textMaterialRemoveButton.setText("Remove");
        textMaterialRemoveButton.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton9ActionPerformed(evt);
            }
        });

        textMaterialAddButton.setText("Add");

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(
                jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(jPanel7Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.LEADING).addGroup(
                javax.swing.GroupLayout.Alignment.TRAILING,
                jPanel7Layout.createSequentialGroup().addContainerGap().addGroup(
                jPanel7Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.TRAILING).addComponent(
                jScrollPane7,
                javax.swing.GroupLayout.Alignment.LEADING,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                419,
                Short.MAX_VALUE).addGroup(
                jPanel7Layout.createSequentialGroup().addComponent(
                textMaterialTxtField,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                285,
                Short.MAX_VALUE).addPreferredGap(
                javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(
                textMaterialAddButton).addPreferredGap(
                javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(
                textMaterialRemoveButton)).addGroup(
                javax.swing.GroupLayout.Alignment.LEADING,
                jPanel7Layout.createSequentialGroup().addComponent(
                jLabel16).addPreferredGap(
                javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(
                textMaterialComboBox,
                javax.swing.GroupLayout.PREFERRED_SIZE,
                109,
                javax.swing.GroupLayout.PREFERRED_SIZE))).addContainerGap()));
        jPanel7Layout.setVerticalGroup(jPanel7Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.LEADING).addGroup(
                javax.swing.GroupLayout.Alignment.TRAILING,
                jPanel7Layout.createSequentialGroup().addContainerGap().addGroup(
                jPanel7Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel16).addComponent(
                textMaterialComboBox,
                javax.swing.GroupLayout.PREFERRED_SIZE,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(
                javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(
                jScrollPane7,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                224, Short.MAX_VALUE).addPreferredGap(
                javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(
                jPanel7Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.BASELINE).addComponent(
                textMaterialRemoveButton).addComponent(
                textMaterialAddButton).addComponent(
                textMaterialTxtField,
                javax.swing.GroupLayout.PREFERRED_SIZE,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                javax.swing.GroupLayout.PREFERRED_SIZE)).addContainerGap()));

        XMLTabbedPane.addTab("Text/Materials", jPanel7);

        referenceScrollPane.setViewportView(referenceList);

        referenceRemoveButton.setText("Remove");
        referenceRemoveButton.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton11ActionPerformed(evt);
            }
        });

        referenceAddButton.setText("Add");

        javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(
                jPanel8);
        jPanel8.setLayout(jPanel8Layout);
        jPanel8Layout.setHorizontalGroup(jPanel8Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 439, Short.MAX_VALUE).addGroup(
                javax.swing.GroupLayout.Alignment.TRAILING,
                jPanel8Layout.createSequentialGroup().addContainerGap().addGroup(
                jPanel8Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.TRAILING).addComponent(
                referenceScrollPane,
                javax.swing.GroupLayout.Alignment.LEADING,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                419,
                Short.MAX_VALUE).addGroup(
                jPanel8Layout.createSequentialGroup().addComponent(
                referenceTxtField,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                285,
                Short.MAX_VALUE).addPreferredGap(
                javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(
                referenceAddButton).addPreferredGap(
                javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(
                referenceRemoveButton))).addContainerGap()));
        jPanel8Layout.setVerticalGroup(jPanel8Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.LEADING).addGroup(
                javax.swing.GroupLayout.Alignment.TRAILING,
                jPanel8Layout.createSequentialGroup().addContainerGap().addComponent(
                referenceScrollPane,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                250, Short.MAX_VALUE).addPreferredGap(
                javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(
                jPanel8Layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.BASELINE).addComponent(
                referenceRemoveButton).addComponent(
                referenceAddButton).addComponent(
                referenceTxtField,
                javax.swing.GroupLayout.PREFERRED_SIZE,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                javax.swing.GroupLayout.PREFERRED_SIZE)).addContainerGap()));

        XMLTabbedPane.addTab("References", jPanel8);

        clearButton.setText("Clear");

        saveButton.setText("Save");

        closeButton.setText("Close");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(
                getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(
                layout.createSequentialGroup().addContainerGap().addComponent(jLabel1).addContainerGap(354, Short.MAX_VALUE)).addGroup(
                javax.swing.GroupLayout.Alignment.TRAILING,
                layout.createSequentialGroup().addContainerGap().addComponent(clearButton).addPreferredGap(
                javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                245, Short.MAX_VALUE).addComponent(closeButton).addPreferredGap(
                javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(saveButton).addContainerGap()).addComponent(XMLTabbedPane,
                javax.swing.GroupLayout.DEFAULT_SIZE, 444,
                Short.MAX_VALUE));
        layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(
                layout.createSequentialGroup().addContainerGap().addComponent(jLabel1).addPreferredGap(
                javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(XMLTabbedPane,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                345, Short.MAX_VALUE).addPreferredGap(
                javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(
                layout.createParallelGroup(
                javax.swing.GroupLayout.Alignment.BASELINE).addComponent(saveButton).addComponent(closeButton).addComponent(clearButton)).addContainerGap()));

        pack();
    }// </editor-fold>

    private void courseCodeTxtFieldActionPerformed(
            java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
    }

    private void courseTitleTxtFieldActionPerformed(
            java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
    }

    private void coursePreRequisiteTxtFieldActionPerformed(
            java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
    }

    private void courseTypeTxtFieldActionPerformed(
            java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
    }

    private void facultyTxtFieldActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
    }

    private void termTxtFieldActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
    }

    private void timeTxtFieldActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
    }

    private void roomTxtFieldActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
    }

    private void requirementRemoveButtonActionPerformed(
            java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
    }

    private void topicWeekTextFieldActionPerformed(
            java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
    }

    private void topicAddButtonActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
    }

    private void topicRemoveButtonActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
    }

    private void assessmentItemTxtFieldActionPerformed(
            java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
    }

    private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
    }

    private void jButton11ActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
    }
    /**
     * @param args
     *            the command line arguments
     */
    /*
     * public static void main(String args[]) {
     * java.awt.EventQueue.invokeLater(new Runnable() { public void run() { }
     * }); }
     */
    // Variables declaration - do not modify
    private javax.swing.JComboBox RequirmentListTypeComboBox;
    private javax.swing.JTabbedPane XMLTabbedPane;
    private javax.swing.JButton assessmentAddButton;
    private javax.swing.JTextField assessmentItemTxtField;
    private javax.swing.JButton assessmentRemoveButton;
    private javax.swing.JTable assessmentTable;
    private javax.swing.JTextField assessmentValueTxtField;
    private javax.swing.JButton clearButton;
    private javax.swing.JButton closeButton;
    private javax.swing.JFormattedTextField courseCodeTxtField;
    private javax.swing.JTextField coursePreRequisiteTxtField;
    private javax.swing.JTextField courseTitleTxtField;
    private javax.swing.JTextField courseTypeTxtField;
    private javax.swing.JTextArea descriptionTxtArea;
    private javax.swing.JTextField facultyTxtField;
    private javax.swing.JButton textMaterialAddButton;
    private javax.swing.JButton referenceRemoveButton;
    private javax.swing.JButton referenceAddButton;
    private javax.swing.JButton textMaterialRemoveButton;
    private javax.swing.JComboBox textMaterialComboBox;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JList textMaterialList;
    private javax.swing.JList referenceList;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JScrollPane jScrollPane6;
    private javax.swing.JScrollPane jScrollPane7;
    private javax.swing.JScrollPane referenceScrollPane;
    private javax.swing.JTextField textMaterialTxtField;
    private javax.swing.JTextField referenceTxtField;
    private javax.swing.JButton objectiveAddButton;
    private javax.swing.JButton objectiveRemoveButton;
    private javax.swing.JTextField objectiveTxtField;
    private javax.swing.JList objectivesList;
    private javax.swing.JTextArea preambleTxtArea;
    private javax.swing.JButton requirementAddButton;
    private javax.swing.JList requirementList;
    private javax.swing.JButton requirementRemoveButton;
    private javax.swing.JTextField requirementTxtField;
    private javax.swing.JTextField roomTxtField;
    private javax.swing.JButton saveButton;
    private javax.swing.JTextField termTxtField;
    private javax.swing.JTextField timeTxtField;
    private javax.swing.JButton topicAddButton;
    private javax.swing.JTextField topicHoursTxtField;
    private javax.swing.JTextField topicNameTxtField;
    private javax.swing.JButton topicRemoveButton;
    private javax.swing.JTextField topicWeekTxtField;
    private javax.swing.JTable topicsTable;
    private javax.swing.JTextField passingGradeTxtField;
    private javax.swing.JButton moveUp1;
    private javax.swing.JButton moveDown1;
    private javax.swing.JButton moveUp2;
    private javax.swing.JButton moveDown2;
    // End of variables declaration
    private DefaultListModel objectiveListModel;
    private DefaultListModel requirementListModel;
    private DefaultListModel textMaterialListModel;
    private DefaultListModel referenceListModel;
    private DefaultTableModel assessmentTableModel;
    private DefaultTableModel topicTableModel;
}
